package com.aizhixin.lab.course.course.entity;

import com.aizhixin.lab.common.entity.AbstractIdAndCreatedDateEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

@Entity(name = "c_course_chapter")
@ToString
public class CourseChapter extends AbstractIdAndCreatedDateEntity {
    @Column(name = "parent_id")
    @Getter
    @Setter
    private Long parentId;
    @Column(name = "template_id")
    @Getter
    @Setter
    private Long templateId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "parentId", fetch = FetchType.EAGER)
    @OrderBy("orderNo ASC")
//    @Where(clause="deleteFlag=0")
    @Getter
    @Setter
    private List<CourseChapter> childrens;
    @Column(name = "course_id")
    @Getter
    @Setter
    private String courseId;
    @Column(name = "name")
    @Getter
    @Setter
    private String name;
    @Column(name = "chapter_no")
    @Getter
    @Setter
    private String chapterNo;
    @Column(name = "order_no")
    @Getter
    @Setter
    private Integer orderNo;
    @Column(name = "type")
    @Getter
    @Setter
    private Integer type;//10:章 20:节
    @Column(name = "is_exp")
    @Getter
    @Setter
    private Boolean isExp;
    @Column(name = "vm_id")
    @Getter
    @Setter
    private String vmId;
    @Column(name = "vm_name")
    @Getter
    @Setter
    private String vmName;
    @Column(name = "vm_num")
    @Getter
    @Setter
    private Integer vmNum;
    @Column(name = "is_hide")
    @Getter
    @Setter
    private Boolean isHide;
    @Column(name = "is_use")
    @Getter
    @Setter
    private Boolean isUse=false;
    @Column(name = "chinese_order_no")
    @Getter
    @Setter
    private String chineseOrderNo;
}
